Add support for GetIncludePaths#178
Add support for GetIncludePaths#178Krishna-13-cyber wants to merge 3 commits intocompiler-research:mainfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #178 +/- ##
==========================================
- Coverage 77.55% 77.18% -0.37%
==========================================
Files 8 8
Lines 2887 3042 +155
==========================================
+ Hits 2239 2348 +109
- Misses 648 694 +46
... and 4 files with indirect coverage changes
|
6819ae4 to
e29e778
Compare
lib/Interpreter/Paths.cpp
Outdated
| Paths.push_back(PathStr); | ||
|
|
||
| // Avoid duplicates | ||
| llvm::SmallVector<llvm::StringRef, val> PathsChecked; |
There was a problem hiding this comment.
warning: unused variable 'Path' [clang-diagnostic-unused-variable]
for (llvm::StringRef Path : PathsChecked)
^19f6118 to
30b74b1
Compare
| const char* GetResourceDir(); | ||
|
|
||
| /// Get Include Paths | ||
| void GetIncludePath(const char* dir, std::vector<std::string>& includePaths); |
There was a problem hiding this comment.
| void GetIncludePath(const char* dir, std::vector<std::string>& includePaths); | |
| void GetIncludePath(std::vector<std::string>& includePaths); |
This function should only have a single output parameter.
There was a problem hiding this comment.
Oh okay, I will make the required changes.
| } | ||
|
|
||
| /// @brief As a interface to store paths added in AddIncludePaths | ||
| std::vector<std::string> include; |
There was a problem hiding this comment.
warning: member variable 'include' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::vector<std::string> include;
^| #undef DEBUG_TYPE | ||
| } | ||
|
|
||
| void GetIncludePaths( |
There was a problem hiding this comment.
warning: an assignment within an 'if' condition is bug-prone [bugprone-assignment-in-if-condition]
if ((Exists = E.Path == Path))
^Additional context
lib/Interpreter/Paths.cpp:450: if it should be an assignment, move it out of the 'if' condition
if ((Exists = E.Path == Path))
^lib/Interpreter/Paths.cpp:450: if it is meant to be an equality check, change '=' to '=='
if ((Exists = E.Path == Path))
^| else | ||
| Paths.push_back(PathStr); | ||
|
|
||
| // Avoid duplicates |
There was a problem hiding this comment.
warning: unused variable 'Path' [clang-diagnostic-unused-variable]
for (llvm::StringRef Path : PathsChecked)
^|
Hi @vgvassilev, |
| } | ||
|
|
||
| /// @brief As a interface to store paths added in AddIncludePaths | ||
| std::vector<std::string> include; |
There was a problem hiding this comment.
Why do we need this. The include paths are stored in the HeaderSearch already.
There was a problem hiding this comment.
So we know that AddincludePaths() is fetching the paths and giving it to HeaderSearch, now GetIncludePaths() had the aim of exposing all the paths which were added(not present in HeaderSearch) to the user, for this we had to get/store all those paths which were being added to HeaderSearch with a vector ( as an interface) as AddIncludePaths() does'nt store any paths (makes it available for HeaderSearch).
Initially, I tried other methods to store all the paths from AddIncludePaths() itself but for that we require a change in function definition and would not require another function GetIncludePaths(). I also tried creating wrappers around AddIncludePaths() but to maintain the function signature I could'nt find a way to store the paths.
|
This PR is stale because it has been open for 90 days with no activity. |
|
Closed through #311. |
This PR adds GetIncludePaths() to fetch the include paths